<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Complete instantiation scheme</title>
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="../../index.html" title="Chapter 1. Boost.Bimap">
<link rel="up" href="../the_tutorial.html" title="The tutorial">
<link rel="prev" href="additional_information.html" title="Additional information">
<link rel="next" href="../bimap_and_boost.html" title="Bimap and Boost">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
<td align="center"><a href="../../../../../../index.html">Home</a></td>
<td align="center"><a href="../../../../../../libs/libraries.htm">Libraries</a></td>
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
<td align="center"><a href="../../../../../../more/index.htm">More</a></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="additional_information.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../the_tutorial.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="../bimap_and_boost.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="boost_bimap.the_tutorial.complete_instantiation_scheme"></a><a class="link" href="complete_instantiation_scheme.html" title="Complete instantiation scheme">Complete
      instantiation scheme</a>
</h3></div></div></div>
<p>
        To summarize, this is the complete instantiation scheme.
      </p>
<pre class="programlisting"><span class="keyword">typedef</span> <span class="identifier">bimap</span>
<span class="special">&lt;</span>
    <span class="identifier">LeftCollectionType</span><span class="special">,</span> <span class="identifier">RightCollectionType</span>

    <span class="special">[</span> <span class="special">,</span> <span class="identifier">SetTypeOfRelation</span>  <span class="special">]</span>  <span class="comment">// Default to left_based</span>
    <span class="special">[</span> <span class="special">,</span> <span class="identifier">with_info</span><span class="special">&lt;</span> <span class="identifier">Info</span> <span class="special">&gt;</span>  <span class="special">]</span>  <span class="comment">// Default to no info</span>
    <span class="special">[</span> <span class="special">,</span> <span class="identifier">Allocator</span>          <span class="special">]</span>  <span class="comment">// Default to std::allocator&lt;&gt;</span>

<span class="special">&gt;</span> <span class="identifier">bm</span><span class="special">;</span>
</pre>
<p>
        <code class="computeroutput"><span class="special">{</span><span class="identifier">Side</span><span class="special">}</span><span class="identifier">CollectionType</span></code>
        can directly be a type. This defaults to <code class="computeroutput"><span class="identifier">set_of</span><span class="special">&lt;</span><span class="identifier">Type</span><span class="special">&gt;</span></code>, or can be a <code class="computeroutput"><span class="special">{</span><span class="identifier">CollectionType</span><span class="special">}</span><span class="identifier">_of</span><span class="special">&lt;</span><span class="identifier">Type</span><span class="special">&gt;</span></code>
        specification. Additionally, the type of this two parameters can be tagged
        to specify user defined names instead of the usual <code class="computeroutput"><span class="identifier">member_at</span><span class="special">::-</span><span class="identifier">Side</span><span class="special">-</span></code> tags.
      </p>
<p>
        The possible way to use the first parameter are:
      </p>
<pre class="programlisting"><span class="identifier">bimap</span><span class="special">&lt;</span> <span class="identifier">Type</span><span class="special">,</span> <span class="identifier">R</span> <span class="special">&gt;</span>
</pre>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
            Left type: <code class="computeroutput"><span class="identifier">Type</span></code>
          </li>
<li class="listitem">
            Left collection type: <code class="computeroutput"><span class="identifier">set_of</span><span class="special">&lt;</span> <span class="identifier">Type</span>
            <span class="special">&gt;</span></code>
          </li>
<li class="listitem">
            Left tag: <code class="computeroutput"><span class="identifier">member_at</span><span class="special">::</span><span class="identifier">left</span></code>
          </li>
</ul></div>
<pre class="programlisting"><span class="identifier">bimap</span><span class="special">&lt;</span> <span class="special">{</span><span class="identifier">CollectionType</span><span class="special">}</span><span class="identifier">_of</span><span class="special">&lt;</span> <span class="identifier">Type</span> <span class="special">&gt;,</span> <span class="identifier">R</span> <span class="special">&gt;</span>
</pre>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
            Left type: <code class="computeroutput"><span class="identifier">Type</span></code>
          </li>
<li class="listitem">
            Left collection type: <code class="computeroutput"><span class="special">{</span><span class="identifier">CollectionType</span><span class="special">}</span><span class="identifier">_of</span><span class="special">&lt;</span> <span class="identifier">LeftType</span> <span class="special">&gt;</span></code>
          </li>
<li class="listitem">
            Left tag: <code class="computeroutput"><span class="identifier">member_at</span><span class="special">::</span><span class="identifier">left</span></code>
          </li>
</ul></div>
<pre class="programlisting"><span class="identifier">bimap</span><span class="special">&lt;</span> <span class="identifier">tagged</span><span class="special">&lt;</span> <span class="identifier">Type</span><span class="special">,</span> <span class="identifier">Tag</span> <span class="special">&gt;,</span> <span class="identifier">R</span> <span class="special">&gt;</span>
</pre>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
            Left type: <code class="computeroutput"><span class="identifier">Type</span></code>
          </li>
<li class="listitem">
            Left collection type: <code class="computeroutput"><span class="identifier">set_of</span><span class="special">&lt;</span> <span class="identifier">LeftType</span>
            <span class="special">&gt;</span></code>
          </li>
<li class="listitem">
            Left tag: <code class="computeroutput"><span class="identifier">Tag</span></code>
          </li>
</ul></div>
<pre class="programlisting"><span class="identifier">bimap</span><span class="special">&lt;</span> <span class="special">{</span><span class="identifier">CollectionType</span><span class="special">}</span><span class="identifier">_of</span><span class="special">&lt;</span> <span class="identifier">tagged</span><span class="special">&lt;</span> <span class="identifier">Type</span><span class="special">,</span> <span class="identifier">Tag</span> <span class="special">&gt;</span> <span class="special">&gt;,</span> <span class="identifier">R</span> <span class="special">&gt;</span>
</pre>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
            Left type: <code class="computeroutput"><span class="identifier">Type</span></code>
          </li>
<li class="listitem">
            Left collection type: <code class="computeroutput"><span class="special">{</span><span class="identifier">CollectionType</span><span class="special">}</span><span class="identifier">_of</span><span class="special">&lt;</span> <span class="identifier">LeftType</span> <span class="special">&gt;</span></code>
          </li>
<li class="listitem">
            Left tag: <code class="computeroutput"><span class="identifier">Tag</span></code>
          </li>
</ul></div>
<p>
        The same options are available for the second parameter.
      </p>
<p>
        The last three parameters are used to specify the collection type of the
        relation, the information member and the allocator type.
      </p>
<p>
        If you want to specify a custom allocator type while relying on the default
        value of CollectionTypeOfRelation, you can do so by simply writing <code class="computeroutput"><span class="identifier">bimap</span><span class="special">&lt;</span><span class="identifier">LeftKeyType</span><span class="special">,</span>
        <span class="identifier">RightKeyType</span><span class="special">,</span>
        <span class="identifier">Allocator</span><span class="special">&gt;</span></code>.
        Boost.Bimap's internal machinery detects that the third parameter in this
        case does not refer to the relation type but rather to an allocator.
      </p>
<p>
        The following are the possible ways of instantiating the last three parameters
        of a bimap. You can ignore some of the parameter but the order must be respected.
      </p>
<pre class="programlisting"><span class="identifier">bimap</span><span class="special">&lt;</span> <span class="identifier">L</span><span class="special">,</span> <span class="identifier">R</span> <span class="special">&gt;</span>
</pre>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
            set_of_relation_type: based on the left key type
          </li>
<li class="listitem">
            info: no info
          </li>
<li class="listitem">
            allocator: std::allocator
          </li>
</ul></div>
<pre class="programlisting"><span class="identifier">bimap</span><span class="special">&lt;</span> <span class="identifier">L</span><span class="special">,</span> <span class="identifier">R</span> <span class="special">,</span><span class="identifier">SetOfRelationType</span><span class="special">&gt;</span>
</pre>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
            set_of_relation_type: SetOfRelationType
          </li>
<li class="listitem">
            info: no info
          </li>
<li class="listitem">
            allocator: std::allocator
          </li>
</ul></div>
<pre class="programlisting"><span class="identifier">bimap</span><span class="special">&lt;</span> <span class="identifier">L</span><span class="special">,</span> <span class="identifier">R</span> <span class="special">,</span> <span class="identifier">SetOfRelationType</span><span class="special">,</span> <span class="identifier">with_info</span><span class="special">&lt;</span><span class="identifier">Info</span><span class="special">&gt;</span> <span class="special">&gt;</span>
</pre>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
            set_of_relation_type: SetOfRelationType
          </li>
<li class="listitem">
            info: Info
          </li>
<li class="listitem">
            allocator: std::allocator
          </li>
</ul></div>
<pre class="programlisting"><span class="identifier">bimap</span><span class="special">&lt;</span> <span class="identifier">L</span><span class="special">,</span> <span class="identifier">R</span> <span class="special">,</span> <span class="identifier">SetOfRelationType</span><span class="special">,</span> <span class="identifier">with_info</span><span class="special">&lt;</span><span class="identifier">Info</span><span class="special">&gt;,</span> <span class="identifier">Allocator</span><span class="special">&gt;</span>
</pre>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
            set_of_relation_type: SetOfRelationType
          </li>
<li class="listitem">
            info: Info
          </li>
<li class="listitem">
            allocator: Allocator
          </li>
</ul></div>
<pre class="programlisting"><span class="identifier">bimap</span><span class="special">&lt;</span> <span class="identifier">L</span><span class="special">,</span> <span class="identifier">R</span> <span class="special">,</span> <span class="identifier">SetOfRelationType</span><span class="special">,</span> <span class="identifier">Allocator</span><span class="special">&gt;</span>
</pre>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
            set_of_relation_type: SetOfRelationType
          </li>
<li class="listitem">
            info: no info
          </li>
<li class="listitem">
            allocator: Allocator
          </li>
</ul></div>
<pre class="programlisting"><span class="identifier">bimap</span><span class="special">&lt;</span> <span class="identifier">L</span><span class="special">,</span> <span class="identifier">R</span> <span class="special">,</span> <span class="identifier">with_info</span><span class="special">&lt;</span><span class="identifier">Info</span><span class="special">&gt;</span> <span class="special">&gt;</span>
</pre>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
            set_of_relation_type: based on the left key type
          </li>
<li class="listitem">
            info: Info
          </li>
<li class="listitem">
            allocator: std::allocator
          </li>
</ul></div>
<pre class="programlisting"><span class="identifier">bimap</span><span class="special">&lt;</span> <span class="identifier">L</span><span class="special">,</span> <span class="identifier">R</span> <span class="special">,</span> <span class="identifier">with_info</span><span class="special">&lt;</span><span class="identifier">Info</span><span class="special">&gt;,</span> <span class="identifier">Allocator</span><span class="special">&gt;</span>
</pre>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
            set_of_relation_type: based on the left key type
          </li>
<li class="listitem">
            allocator: Allocator
          </li>
</ul></div>
<pre class="programlisting"><span class="identifier">bimap</span><span class="special">&lt;</span> <span class="identifier">L</span><span class="special">,</span> <span class="identifier">R</span> <span class="special">,</span> <span class="identifier">Allocator</span><span class="special">&gt;</span>
</pre>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
            set_of_relation_type: based on the left key type
          </li>
<li class="listitem">
            info: no info
          </li>
<li class="listitem">
            allocator: Allocator
          </li>
</ul></div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright © 2006-2012 Matias Capeletto<p>
        Distributed under the Boost Software License, Version 1.0. (See accompanying
        file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
      </p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="additional_information.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../the_tutorial.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="../bimap_and_boost.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>
